package com.study.queue;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * Created By gtx on 2017/8/12/11:49
 */
public class QueueDemo {

    public static void main(String[] args) {

        try {
            Queue<User> queue = new CuratorQueue<User>();

//        List<User> userList = new ArrayList<User>();
            for (int i=0;i<20;i++){
                User user = new User("gtx"+i,i);
    //            userList.add(user);
                queue.add(user);
            }

            System.err.println("1:element  2:poll ");
            while(true){
                if (queue.isEmpty())break;
                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                Integer action = Integer.parseInt(br.readLine());

                switch (action){
                    case 1:
                        System.out.println("element()-->"+queue.element());
                        break;
                    case 2:
                        System.out.println("poll()-->"+queue.poll());
                        break;
                    default:
                        System.out.println("哈哈哈哈哈");
                        break;
                }
            }
            System.out.println("队列已经空空如也");
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
